package com.ossjk.qlh.minapp.OrderID;

import java.text.SimpleDateFormat;
import java.util.Date;

public enum OrderType {

    DD_ORDER("DD-","DD-", "yyyyMMdd", 5, 4, (24 * 60 * 60 * 1000L));


    /**
     * 缓存key
     */
    private String cacheKeyPrefix;

    /**
     * 单号前缀
     * 为空时填""
     */
    private String prefix;

    /**
     * 时间格式表达式
     * 例如：yyyyMMdd
     */
    private String datePattern;
    /**
     * 随机数长度
     */
    private Integer randomLength;

    /**
     * 流水号长度
     */
    private Integer serialLength;


    /**
     * 缓存时常
     */
    private Long duration;

    OrderType(String cacheKeyPrefix, String prefix, String datePattern, Integer randomLength, Integer serialLength, Long duration) {
        this.cacheKeyPrefix = cacheKeyPrefix;
        this.prefix = prefix;
        this.datePattern = datePattern;
        this.randomLength = randomLength;
        this.serialLength = serialLength;
        this.duration = duration;
    }

    public String getCacheKeyPrefix() {
        return cacheKeyPrefix;
    }

    public String getPrefix() {
        return prefix;
    }

    public String getDatePattern() {
        return datePattern;
    }

    public Integer getRandomLength() {
        return randomLength;
    }

    public Integer getSerialLength() {
        return serialLength;
    }

    public Long getDuration() {
        return duration;
    }


}
